import { request } from '../request';

export function chatUser(
  params: {
    order: string;
    query: string;
  } & Api.PageParam,
) {
  return request<
    Api.PageVO<
      {
        showRed: boolean;
        relativeTime: string;
        chatUser: Api.BaseUserVO;
      } & Api.ChatUser
    >
  >({
    url: '/chat/user',
    method: 'post',
    data: params,
  });
}

export function chatInfo(
  params: {
    receiveUserId: string;
  } & Api.PageParam,
) {
  return request<
    Api.PageVO<
      {
        sendUser: Api.BaseUserVO;
      } & Api.ChatInfo
    >
  >({
    url: '/chat/info',
    method: 'post',
    data: params,
  });
}

export function chatSend(params: { receiveUserId: string; msg: string }) {
  return request<
    {
      sendUser: Api.BaseUserVO;
    } & Api.ChatInfo
  >({
    url: '/chat/send',
    method: 'post',
    data: params,
  });
}

export function chatFlag(params: { userId: string }) {
  return request<boolean>({
    url: '/chat/flag',
    method: 'post',
    data: params,
  });
}

export function chatTag() {
  return request<boolean>({
    url: '/chat/tag',
    method: 'post',
  });
}

export function chatDel(params: { id: string }) {
  return request<boolean>({
    url: '/chat/del',
    method: 'post',
    data: params,
  });
}

export function chatNew(params: { userId: string }) {
  return request<
    {
      showRed: boolean;
      relativeTime: string;
      chatUser: Api.BaseUserVO;
    } & Api.ChatUser
  >({
    url: '/chat/new',
    method: 'post',
    data: params,
  });
}

export function chatSelectUser(
  params: {
    query: string;
  } & Api.PageParam,
) {
  return request<Api.PageVO<Api.BaseUserVO>>({
    url: '/chat/select-user',
    method: 'post',
    data: params,
  });
}
